from pymysql import Connection
import datetime

# 构建MySQL链接对象
conn = Connection(
    host="localhost",
    port=3306,
    user="root",
    password="root",
    autocommit=True   # 因为如果是insert 插入语句的话需要手动commit，这样表示自动
)

# 获得游标对象
cursor = conn.cursor()

# 选择数据库
conn.select_db("love_story")
# 查询
cursor.execute("SELECT create_time FROM photo")
result = cursor.fetchall()

for item in result:
    timestamp = datetime.datetime.now().timestamp()

    # cursor.execute(f"UPDATE photo SET create_time={new_time}")

    print(timestamp)
# 关闭MySQL链接对象
conn.close()
# print(result)
